

(function() {

    // 新的代码
    var QQLink = 'tencent://message/?Menu=yes&amp;amp;uin=710553244&amp;amp;Service=58&amp;amp;SigT=A7F6FEA02730C98890ADA65657297F6917A6C0A1680C4AC22B330049752D7E562DBFC56BDD3BE30E1FAFEB6EA8BD8191B86FB138649A002B49AAEC4C18871E6745238C22F66516EFB42862664AE58C7C27C1AD1DB39518B09E30E334E1EE2E10F7EEF3A7D9129B992A56A781ACB644257CFA70B2D231FB0C&amp;amp;SigU=30E5D5233A443AB2D85DB168425A57D2780C40138DB5A8FBF4FBFFEB28FC8E988482ADCDCF846ACF9563C6C436711F98873E7FACF1E658AEF417466403DD6B29482E1A577C17763D';
    var QQ_SERVICE_HTML = {
        "boxHead": "<div class='QQbox' id='divQQbox' >",
        
            "listHead": "<div class='Qlist' id='divOnline'  style='display : block;'>",
               
                "closeBtn": "<div class='t'><span id='close'></span></div>",
               
                "title": "<div class='infobox'>在线客服</div>",
                
                "conHead": "<div class='con'><ul>",
                
                    "li1": "<li>"
                            + "<img border='0' src='/statics/site/images/qq_service/zx_qq.gif' width='100' height='31' alt='点击这里给我发消息' title='欧模网客服' id='jk_ToQQKF' style='cursor:pointer;' onclick=\"javascript:window.open(\'" + QQLink + "\', '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');\"/>"
                            + "<p style='margin:10px 0;line-height:12px;'>客服QQ: 710553244 </p>"
                        + "</li>",
                    "li2": '<li>'
                            + '<font color=#FF0000 size="3"><strong>咨询热线</strong></font>'
                            + '<p style="margin:2px 0 0;"><strong style="font-size:14px;">座机：028-84450270  手机：17721888895</strong></p>'
                        + '</li>',
                    "li3": '<li>'
                            // + '<p>充值388元=3880欧币</p><p>充值1000元=10000欧币</p>'
                            // + '<p style="text-align:right; color:red;margin-right:17px;margin-top:-12px;">+送1000欧币</p>'
                            // + '<p>充值2000元=20000欧币</p>'
                            // + '<p style="text-align:right; color:red;margin-right:17px;margin-top:-12px;">+送2000欧币</p>'
                            // + '<p>2016专辑正在火热出售中！送vip课程!</p><p>欧模顶级商业图像团队，接受高端图像定制，欢迎垂询！<p>'
                        + '</li>',
                    "li4": '<li><p><b>上班时间</b></p><p>周一至周日9:00-22:00</p></li>',
                    
                "conTail": "</ul></div>",
                
                "hr": "<div class='b'></div>",
                
            "listTail": "</div>",
            
            "showBtn": "<div id='divMenu' style='display : none;'>"
                    + "<img src='/statics/site/images/qq_service/kf-one.gif' class='press' alt='在线咨询'>"
                + "</div>",
            
        "boxTail": "</div>"
    };

    var _html = QQ_SERVICE_HTML.boxHead
        + QQ_SERVICE_HTML.listHead
            + QQ_SERVICE_HTML.closeBtn
            + QQ_SERVICE_HTML.title
            + QQ_SERVICE_HTML.conHead
            
                + QQ_SERVICE_HTML.li1
                + QQ_SERVICE_HTML.li2
                + QQ_SERVICE_HTML.li3
                + QQ_SERVICE_HTML.li4
                
            + QQ_SERVICE_HTML.conTail
            + QQ_SERVICE_HTML.hr
        + QQ_SERVICE_HTML.listTail
        + QQ_SERVICE_HTML.showBtn
    + QQ_SERVICE_HTML.boxTail;


    document.write(_html);

    //<![CDATA[
    var tips;
    var theTop = 70 /*这是默认高度,越大越往下*/ ;
    var old = theTop;

    function initFloatTips() {
        tips = document.getElementById('divQQbox');
        moveTips();
    }

    function moveTips() {
            var tt = 50;
            if (window.innerHeight) {
                pos = window.pageYOffset
            } else if (document.documentElement && document.documentElement.scrollTop) {
                pos = document.documentElement.scrollTop
            } else if (document.body) {
                pos = document.body.scrollTop;
            }
            pos = pos - tips.offsetTop + theTop;
            pos = tips.offsetTop + pos / 10;
            if (pos < theTop) pos = theTop;
            if (pos != old) {
                tips.style.top = pos + "px";
                tt = 10;
                //alert(tips.style.top);
            }
            old = pos;
            setTimeout(moveTips, tt);
    }
    //!]]>

    initFloatTips();

    function OnlineOver() {
        document.getElementById("divMenu").style.display = "none";
        document.getElementById("divOnline").style.display = "block";
        document.getElementById("divQQbox").style.width = "170px";
    }

    function OnlineOut() {
        document.getElementById("divMenu").style.display = "block";
        document.getElementById("divOnline").style.display = "none";
    }

    if (typeof(HTMLElement) != "undefined") //给firefox定义contains()方法，ie下不起作用
    {
        HTMLElement.prototype.contains = function(obj) {
            while (obj != null && typeof(obj.tagName) != "undefind") { //通过循环对比来判断是不是obj的父元素
                　　　　
                if (obj == this) return true;　　　　
                obj = obj.parentNode;　　
            }
            return false;
        };
    }

    function hideMsgBox(theEvent) { //theEvent用来传入事件，Firefox的方式
        　
        if (theEvent) {　
            var browser = navigator.userAgent; //取得浏览器属性
            　
            if (browser.indexOf("Firefox") > 0) { //如果是Firefox
                　　
                if (document.getElementById('divOnline').contains(theEvent.relatedTarget)) { //如果是子元素
                    　　
                    return; //结束函式
                }
            }
            if (browser.indexOf("MSIE") > 0) { //如果是IE
                if (document.getElementById('divOnline').contains(event.toElement)) { //如果是子元素
                    return; //结束函式
                }
            }
        }
        /*要执行的操作*/
        document.getElementById("divMenu").style.display = "block";
        document.getElementById("divOnline").style.display = "none";
    }
    
    $("#close").on("click", function(event) {
        hideMsgBox(event);
    });
    
    $("#divMenu").on("click", function() {
        OnlineOver();
    });
    
})();

